﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace S.EarTag.Domain.Migrations
{
    public partial class 第一次迁移 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AppearanceModel",
                columns: table => new
                {
                    AppearanceId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MeasureDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    EITag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Tooth = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Hair = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Stain = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    HoofColor = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MouthColor = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Angle = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FatDistribution = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateDate = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppearanceModel", x => x.AppearanceId);
                });

            migrationBuilder.CreateTable(
                name: "BodyMeasureModel",
                columns: table => new
                {
                    BodyMeasureId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MeasureDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    EITag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Height = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    BodyLength = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Chest = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Tube = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Oschea = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Backfat = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    EyeMuscleArea = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    EyeMuscleWidth = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CreateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateDate = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BodyMeasureModel", x => x.BodyMeasureId);
                });

            migrationBuilder.CreateTable(
                name: "BreedingWeigh",
                columns: table => new
                {
                    BreedingID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SheepFileId = table.Column<int>(type: "int", nullable: false),
                    WeighDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    MarkId = table.Column<int>(type: "int", nullable: false),
                    EITag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WeighCategory = table.Column<int>(type: "int", nullable: false),
                    Weight = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    WeightMonthsAge = table.Column<int>(type: "int", nullable: false),
                    BuildingName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LogicalDeletion = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BreedingWeigh", x => x.BreedingID);
                });

            migrationBuilder.CreateTable(
                name: "EarTagModel",
                columns: table => new
                {
                    EarTagId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WarehousingDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    BirthState = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedItem = table.Column<int>(type: "int", nullable: false),
                    EarTag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UseState = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateDate = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EarTagModel", x => x.EarTagId);
                });

            migrationBuilder.CreateTable(
                name: "EarTagOrMarkModel",
                columns: table => new
                {
                    EarTagOrMarkId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EarTagId = table.Column<int>(type: "int", nullable: false),
                    MarkId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EarTagOrMarkModel", x => x.EarTagOrMarkId);
                });

            migrationBuilder.CreateTable(
                name: "MarkModel",
                columns: table => new
                {
                    MarkId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EarTag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EITag = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WearId = table.Column<int>(type: "int", nullable: false),
                    MarkState = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    UpdateDate = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MarkModel", x => x.MarkId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AppearanceModel");

            migrationBuilder.DropTable(
                name: "BodyMeasureModel");

            migrationBuilder.DropTable(
                name: "BreedingWeigh");

            migrationBuilder.DropTable(
                name: "EarTagModel");

            migrationBuilder.DropTable(
                name: "EarTagOrMarkModel");

            migrationBuilder.DropTable(
                name: "MarkModel");
        }
    }
}
